﻿Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class LandschaftstexturWald
    Inherits ObjektLandschaftsTextur

    Dim TexturLandschaftUntergrund As Texture
    Dim TexturBaum As Texture
    Dim Mesh As Objekt3D

    Public Sub New()
        ID = "WALD"
        Landschaftsname = "Wald"
        Deckung = 2
        Tarnung = True
        KP = -1
        TexturenLaden(New String() {"Wald", "Wald+1"})
        Normal = 1
        Ausrichtungslandschaften = New String() {}

        If DataSettings.draw3D Then
            Ini3D()
        End If
    End Sub

    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"EBENE", "WUESTE", "SCHNEE"}
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)
        Grafikengine.Grafikkarte.SetTexture(0, TexturLandschaftUntergrund)
        Dim standardMatrix As Matrix = Grafikengine.Grafikkarte.Transform.World
        Grafikengine.Grafikkarte.Transform.World = p_MatCube

        'Berechnen:
        Dim Farbe As Color = ObjektmarkiertesFeld.getFeldFarbe(Landschaft.KooX, Landschaft.KooY)
        Dim cube(3) As CustomVertex.PositionNormalTextured
        cube(0) = New CustomVertex.PositionNormalTextured(0, 0, 0, 0, 1, 0, 0, 1)
        cube(1) = New CustomVertex.PositionNormalTextured(0, 0, 1, 0, 1, 0, 0, 0)
        cube(2) = New CustomVertex.PositionNormalTextured(1, 0, 0, 0, 1, 0, 1, 1)
        cube(3) = New CustomVertex.PositionNormalTextured(1, 0, 1, 0, 1, 0, 1, 0)

        'Anzeigen:
        Grafikengine.Grafikkarte.VertexFormat = CustomVertex.PositionNormalTextured.Format
        Dim M As New Material
        M.Diffuse = Farbe
        Grafikengine.Grafikkarte.Material = M
        Grafikengine.Grafikkarte.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, cube)

        ''Berechnen:
        'Dim Baum(3) As CustomVertex.PositionColoredTextured
        'Baum(0) = New CustomVertex.PositionColoredTextured(0, 1.279296875, 0.5, Color.FromArgb(0, 255, 255, 255).ToArgb, 0, 0)
        'Baum(1) = New CustomVertex.PositionColoredTextured(1, 1.279296875, 0.5, Color.FromArgb(0, 255, 255, 255).ToArgb, 1, 0)
        'Baum(2) = New CustomVertex.PositionColoredTextured(0, 0, 0.5, Color.FromArgb(0, 255, 255, 255).ToArgb, 0, 1)
        'Baum(3) = New CustomVertex.PositionColoredTextured(1, 0, 0.5, Color.FromArgb(0, 255, 255, 255).ToArgb, 1, 1)
        ''Anzeigen:
        'Grafikengine.Grafikkarte.SetTexture(0, TexturBaum)
        'Grafikengine.Grafikkarte.VertexFormat = CustomVertex.PositionColoredTextured.Format
        'Grafikengine.Grafikkarte.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, Baum)
        'Baum(2) = Baum(1)
        'Baum(1) = New CustomVertex.PositionColoredTextured(0, 0, 0.5, Color.FromArgb(0, 0, 0, 0).ToArgb, 0, 1)
        'Grafikengine.Grafikkarte.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, Baum)
        Dim X As Single = p_MatCube.M41
        Dim Y As Single = p_MatCube.M43
        p_MatCube.M41 = X + 0.109
        p_MatCube.M43 = Y + 0.32
        'Grafikengine.Grafikkarte.Transform.World = p_MatCube
        Mesh.Malen(p_MatCube)

        p_MatCube.M41 = X + 0.616
        p_MatCube.M43 = Y + 0.03
        'Grafikengine.Grafikkarte.Transform.World = p_MatCube
        Mesh.Malen(p_MatCube)

        p_MatCube.M41 = X + 0.33
        p_MatCube.M43 = Y + 0.707
        'Grafikengine.Grafikkarte.Transform.World = p_MatCube
        Mesh.Malen(p_MatCube)

        p_MatCube.M41 = X + 0.82
        p_MatCube.M43 = Y + 0.33
        'Grafikengine.Grafikkarte.Transform.World = p_MatCube
        Mesh.Malen(p_MatCube)

        p_MatCube.M41 = X + 0.808
        p_MatCube.M43 = Y + 0.84
        'Grafikengine.Grafikkarte.Transform.World = p_MatCube
        Mesh.Malen(p_MatCube)

        'Wieder den Ursprungsstatus wiederherstellen..
        Grafikengine.Grafikkarte.Transform.World = standardMatrix
    End Sub

    Public Overrides Sub Ini3D()
        TexturLandschaftUntergrund = Grafikengine.LoadTexture(DataSettings.Resourcenpfad + "Terrain\Overworld\3D\" + DataSettings.TexturQuali + "\Waldboden.png")
        '  TexturBaum = Grafikengine.LoadTexture(DataSettings.Resourcenpfad + "Terrain\Overworld\3D\" + DataSettings.TexturQuali + "\Baum.png")
        Mesh = New Objekt3D
        Mesh.MeshBildLaden(DataSettings.Resourcenpfad + "Terrain\Meshes\Baum.X")
    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
Public Class LandschaftstexturKakteen
    Inherits ObjektLandschaftsTextur



    Public Sub New()
        ID = "KAKTEEN"
        Landschaftsname = "Kakteen"
        Deckung = 2
        Tarnung = True
        KP = -1
        TexturenLaden(New String() {"Kakteen"})
        Normal = 0
        Ausrichtungslandschaften = New String() {}
    End Sub

    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"WUESTE", "EBENE", "SCHNEE"}
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)

    End Sub

    Public Overrides Sub Ini3D()

    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
Public Class LandschaftstexturKieferen
    Inherits ObjektLandschaftsTextur



    Public Sub New()
        ID = "KIEFERN"
        Landschaftsname = "Kiefernwald"
        Deckung = 2
        Tarnung = True
        KP = -1
        TexturenLaden(New String() {"Kiefern+0", "Kiefern+1"})
        Normal = 1
        Ausrichtungslandschaften = New String() {}
    End Sub

    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"SCHNEE", "EBENE", "WUESTE"}
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)

    End Sub

    Public Overrides Sub Ini3D()

    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
